home *** CD-ROM | disk | FTP | other *** search
- #
- # GAMELOT (sorry...)
- #
- # gamelan like melody
- #
- # Taken from "Music of the Whole Earth", David Reck
- #
-
- #
- # uses fb01 to take advantage of cents tuning.
- #
- # four modes, 3 slendo and 1 pelog
- # piece switches states between 3 slendo modes and 1 pelog
- # scale, that is not really setup for any particular mode.
- #
-
- MAXNOTE = 18
- SLENDRONOTES = 16
- PELOGNOTES = 18
-
- uchar snotes[MAXNOTE]
- uchar scents[MAXNOTE]
-
- uchar mode # current mode
- uchar melnote # global melody note
- uchar meltime # global melody time
- uchar counter
- uchar nonotes
-
- # set up 5 tone slendro scale
- # slendro 5 tones are 263,223,253,236,225 cents apart in one octave
- # sets up a slendo scale, assuming 5 notes with correct cents
- # not used, but shows basic notes and cents. Key of C.
- #
- riff initSlendro()
- snotes[0] = C
- scents[0] = 0
- snotes[1] = D
- scents[1] = 63
- snotes[2] = E
- scents[2] = 86
- snotes[3] = G
- scents[3] = 39
- snotes[4] = A
- scents[4] = 75
- end
-
- # 7 tone pelog scale
- # mode is lima
- #
- # C,C#,E,F,F#,A,B with appropriate cents
- #
- # 5 F
- # 4 B
- # 3 E
- #
- # 2 C
- # 2 A
- #
- # 1 C#
- # 1 F#
- # 18 notes needed
- riff initPelog()
- snotes[0] = C
- scents[0] = 0
- snotes[7] = HC
- scents[7] = 0
-
- snotes[1] = C#
- scents[1] = 67
-
- snotes[2] = E
- scents[2] = 12
- snotes[8] = HE
- scents[8] = 12
- snotes[9] = HE
- scents[9] = 12
-
- snotes[10] = HF
- scents[10] = 37
- snotes[3] = F
- scents[3] = 37
- snotes[17] = F
- scents[17] = 37
- snotes[16] = F
- scents[16] = 37
- snotes[15] = LF
- scents[15] = 37
-
- snotes[4] = F#
- scents[4] = 83
-
- snotes[5] = A
- scents[5] = 35
- snotes[12] = HA
- scents[12] = 35
-
- snotes[14] = LB
- scents[14] = 0
- snotes[6] = B
- scents[6] = 0
- snotes[11] = HB
- scents[11] = 0
- snotes[13] = B
- scents[13] = 0
-
- end
-
-
- # nem mode
- # C,E,A emphasized, others are auxilliary
- # we span two octaves
- # 5 c
- # 4 e
- # 3 a
- # 2 d, 2 g
- riff initNem()
- snotes[0] = C
- scents[0] = 0
- snotes[5] = HC
- scents[5] = 0
- snotes[6] = C
- scents[6] = 0
- snotes[7] = HC
- scents[7] = 0
- snotes[12] = LC
- scents[12] = 0
-
- snotes[1] = D
- scents[1] = 63
- snotes[14] = HD
- scents[14] = 63
-
- snotes[2] = E
- scents[2] = 86
- snotes[8] = HE
- scents[8] = 86
- snotes[9] = E
- scents[9] = 86
- snotes[10] = HE
- scents[10] = 86
-
- snotes[3] = G
- scents[3] = 39
- snotes[15] = HG
- scents[15] = 39
-
- snotes[4] = A
- scents[4] = 75
- snotes[11] = HA
- scents[11] = 75
- snotes[13] = HA
- scents[13] = 75
-
- end
-
- # sanga mode
- #
- # 5 e
- # 4 a
- # 3 d
- # 2 c
- # 2 g
- #
- riff initSanga()
- snotes[0] = C
- scents[0] = 0
- snotes[14] = HC
- scents[14] = 0
-
- snotes[1] = D
- scents[1] = 63
- snotes[5] = HD
- scents[5] = 63
- snotes[6] = D
- scents[6] = 63
-
- snotes[7] = LE
- scents[7] = 86
- snotes[2] = E
- scents[2] = 86
- snotes[8] = HE
- scents[8] = 86
- snotes[9] = E
- scents[9] = 86
- snotes[10] = HE
- scents[10] = 86
-
- snotes[3] = G
- scents[3] = 39
- snotes[15] = HG
- scents[15] = 39
-
- snotes[4] = A
- scents[4] = 75
- snotes[11] = HA
- scents[11] = 75
- snotes[12] = A
- scents[12] = 75
- snotes[13] = HA
- scents[13] = 75
-
- end
-
- #
- # slendro scale, manjura mode
- #
- # 5 g
- # 4 c
- # 3 e
- # 2 d
- # 2 a
- #
- riff initManjura()
- snotes[0] = C
- scents[0] = 0
- snotes[5] = HC
- scents[5] = 0
- snotes[6] = C
- scents[6] = 0
- snotes[7] = HC
- scents[7] = 0
-
- snotes[1] = D
- scents[1] = 63
- snotes[14] = HD
- scents[14] = 63
-
- snotes[2] = E
- scents[2] = 86
- snotes[8] = HE
- scents[8] = 86
- snotes[9] = E
- scents[9] = 86
-
- snotes[10] = LG
- scents[10] = 39
- snotes[3] = G
- scents[3] = 39
- snotes[11] = HG
- scents[11] = 39
- snotes[12] = G
- scents[12] = 39
- snotes[13] = HG
- scents[13] = 39
-
- snotes[4] = A
- scents[4] = 75
- snotes[15] = HA
- scents[15] = 75
- end
-
- riff nextMode()
- if ( mode == 0 )
- nonotes = SLENDRONOTES
- void initNem()
- counter = 90
- metro 85
- else
- if ( mode == 1 )
- nonotes = SLENDRONOTES
- void initSanga()
- counter = 125
- metro 145
- else
- if ( mode == 2)
- nonotes = SLENDRONOTES
- void initManjura()
- counter = 140
- metro 160
- else
- nonotes = PELOGNOTES
- void initPelog()
- counter = 175
- metro 175
- end
- end
- end
- void printf("%d\n",mode)
- mode++
- if ( mode == 4)
- mode = 0
- end
- end
-
- vco s1
- uchar sectcount
-
- counter = 0
- mode = 0
-
- sectcount = 0
-
- for(;;)
- # choose mode
- if ( counter == 0 )
- void nextMode()
- sectcount++
- end
- counter--
- #
- # play note
- #
- melnote = mrandrange(0,nonotes)
- if ( mrand() % 2 )
- meltime = q
- else
- meltime = e
- end
- snotes[melnote] meltime mrandrange(100,127) scents[melnote]
-
- end
- end
-
-
- # one every 2 (may have double beat)
- vco low
- uchar rval
- for (;;)
- rval = mrand() % 3
- if (rval == 0)
- snotes[melnote]-12 h mrandrange(100,127) scents[melnote]
- else
- snotes[melnote]-12 q mrandrange(100,127) scents[melnote]
- snotes[melnote]-12 q mrandrange(100,127) scents[melnote]
- end
- end
- end
-
- # one every 4
- vco lower
- uchar nnote
- for (;;)
- snotes[melnote]-24 q mrandrange(100,127) scents[melnote]
- rest q
- rest q
- rest q
- end
- end
-
-
- # once every 16
- vco whole
- uchar nnote
- for (;;)
- if ( {mrand() % 3} == 1)
- snotes[melnote]-36 w 127 scents[melnote]
- else
- rest w
- end
- rest w
- rest w
- rest w
- end
- end
-